<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<link rel="stylesheet" href="./animate.css">
	<script src="./vue.js"></script>
	<script src="./velocity.js"></script>
</head>
<style>
	.v-enter, .v-leave-to {opacity: 0}
	.v-enter-active, .v-leave-active {transition: opacity 1s;}
</style>
<body>
	<div id="root">
		<transition mode="out-in">
			<component :is="type"></component>
		</transition>
		<button @click="handleClick">切换</button>
	</div>
	
	<script>

		Vue.component('child', {
			template: '<div>this is child</div>'
		})

		Vue.component('child-one', {
			template: '<div>this is child-one</div>'
		})

		var vm = new Vue({
			el: '#root',
			data: {	
				type: 'child'
			},
			methods: {
				handleClick () {
					this.type = this.type === 'child' ? 'child-one' : 'child';
				}
			}
		})
	</script>
</body>
</html>